package com.zr.inquiry.controller;

import com.zr.inquiryenum.*;
import com.zr.util.ResultVo;
import com.zr.util.ResultVoBuilder;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by 天赐 on 2019/12/27.
 */
@RestController
@CrossOrigin
public class EnumController {

    /*询价下拉框*/
    @PostMapping("procurement/getPullDownList")
    public ResultVo xiala(){

        Map<String,List> map = new HashMap<>();

        List<EnumVo> list = new ArrayList<>();
        for (IsTaxEnum t: IsTaxEnum.values()) {
            EnumVo ev = new EnumVo(t.getName(),t.getValue());
            list.add(ev);
        }

        List<EnumVo> list2 = new ArrayList<>();
        for (currencyCodeEnum t: currencyCodeEnum.values()) {
            EnumVo ev = new EnumVo(t.getName(),t.getValue());
            list2.add(ev);
        }

        List<EnumVo> list3 = new ArrayList<>();
        for (inquiryStatusEnum t: inquiryStatusEnum.values()) {
            EnumVo ev = new EnumVo(t.getName(),t.getValue());
            list3.add(ev);
        }

        List<EnumVo> list4 = new ArrayList<>();
        for (TypeEnum t: TypeEnum.values()) {
            EnumVo ev = new EnumVo(t.getName(),t.getValue());
            list4.add(ev);
        }

        map.put("currencyCode",list2);
        map.put("isTax",list);
        map.put("type",list3);
        map.put("inquiryStatus",list4);

        return ResultVoBuilder.success(map);
    }

}
